Skip to content

[Auto] Implement centralized error handling middleware#15

Draft
landoyjx wants to merge 1 commit intomainfrom
auto/3-implement-centralized-error-handling-middleware
Draft

[Auto] Implement centralized error handling middleware#15
landoyjx wants to merge 1 commit intomainfrom
auto/3-implement-centralized-error-handling-middleware

Conversation

@landoyjx
Copy link
Copy Markdown
Owner

Build a centralized error handler that catches all errors and returns consistent JSON responses with appropriate HTTP status codes (e.g., 400 for validation errors, 404 for missing resources, 500 for unexpected errors).

Acceptance Criteria:

  • All errors are returned as JSON objects with message and optionally code
  • Unhandled routes return 404 Not Found with JSON body
  • Validation errors return 400 Bad Request with JSON body

Test Cases:

  • Unit: Throwing a custom 404 error returns { "message": "..." } with status 404
  • Unit: Throwing a validation error returns { "message": "..." } with status 400
  • Edge: An unhandled exception returns 500 with a generic error message

View issue: #3


Created by bass auto-programming

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant